package logic

import (
	"context"

	"backend/apps/book/api/internal/svc"
	"backend/apps/book/api/internal/types"
	"backend/apps/book/proto"

	"github.com/zeromicro/go-zero/core/logx"
)

type DeleteAuthorLogic struct {
	logx.Logger
	ctx    context.Context
	svcCtx *svc.ServiceContext
}

func NewDeleteAuthorLogic(ctx context.Context, svcCtx *svc.ServiceContext) *DeleteAuthorLogic {
	return &DeleteAuthorLogic{
		Logger: logx.WithContext(ctx),
		ctx:    ctx,
		svcCtx: svcCtx,
	}
}

func (l *DeleteAuthorLogic) DeleteAuthor(req *types.IdRequest) (resp *types.CommonResponse, err error) {
	_, err = l.svcCtx.BookRpc.DeleteAuthor(l.ctx, &proto.IdRequest{Id: req.Id})
	return resp, err
}
